/**
 * Created by YS on 2017/12/21.
 */
var fs =require('fs')
var aaa='08.txt'

fs.exists(aaa,function(isExists){
    console.log(isExists)
    if(!isExists){
        fs.writeFile(aaa,'hello',function (err) {
            if (err){
                console.log('出错')
            }else{
                console.log('08.txt 创建成功')
            }
        })
    }else{
        fs.appendFile(aaa,'你好',function (err) {
            if (err){
                console.log('新内容追加失败')
            }else{
                console.log('新内容追加成功')
            }

        })
    }
})